home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_222 / plplot / src / source.zoo / plhrsh.c < prev    next >
C/C++ Source or Header  |  1989-05-15  |  1KB  |  50 lines

  1. /* Writes the Hershey symbol "ch" centred at the physical */
  2. /* coordinate (x,y) */
  3.  
  4. #include "plplot.h"
  5.  
  6. void plhrsh(ch,x,y)
  7. int ch, x, y;
  8. {
  9.       int cx, cy, k, penup;
  10.       short int xygrid[300];
  11.       float symdef, symht, scale, xscale, yscale, xpmm, ypmm;
  12.  
  13.       gsym(&symdef,&symht);
  14.       gpixmm(&xpmm,&ypmm);
  15.       k = 5;
  16.       penup = 1;
  17.       scale = 0.05 * symht;
  18.  
  19.       if (!plcvec(ch,xygrid)) {
  20.         movphy(x,y);
  21.         return;
  22.       }
  23.       
  24.       /* Compute how many physical pixels correspond to a character pixel */
  25.  
  26.       xscale = scale * xpmm;
  27.       yscale = scale * ypmm;
  28.  
  29.       for(;;) {
  30.         cx = xygrid[k];
  31.         k = k+1;
  32.         cy = xygrid[k];
  33.         k = k+1;
  34.         if (cx == -64 && cy == -64) {
  35.           movphy(x,y);
  36.           return;
  37.         }
  38.         else if (cx == -64 && cy == 0) 
  39.           penup = 1;
  40.         else  {
  41.           if (penup != 0) {
  42.             movphy(round(x+xscale*cx),round(y+yscale*cy));
  43.             penup = 0;
  44.           }
  45.           else
  46.             draphy(round(x+xscale*cx),round(y+yscale*cy));
  47.         }
  48.       }
  49. }
  50.